home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / Gnuplot / Source / term / bigfig.trm < prev    next >
Encoding:
Text File  |  1993-03-02  |  3.6 KB  |  129 lines

  1. /*
  2.  * $Id: bigfig.trm%v 3.38.2.74 1993/02/19 01:11:43 woo Exp woo $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT - fig.trm */
  7. /*
  8.  * Copyright (C) 1990 - 1993
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted,
  12.  * provided that the above copyright notice appear in all copies and
  13.  * that both that copyright notice and this permission notice appear
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed
  18.  * as patches to released version.
  19.  *
  20.  * This software  is provided "as is" without express or implied warranty.
  21.  *
  22.  * This file is included by ../term.c.
  23.  *
  24.  * This terminal driver supports:
  25.  *  Fig graphics language
  26.  *
  27.  * AUTHORS
  28.  *  Micah Beck, David Kotz
  29.  *
  30.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  31.  *
  32.  */
  33.  
  34. /*
  35.  * Original for Fig code output by Micah Beck, 1989
  36.  * Department of Computer Science, Cornell University
  37.  * Updated by David Kotz for gnuplot 2.0
  38.  * More efficient output by Ian Dall
  39.  * Increased size of plot by Ian Dall
  40.  */
  41.  
  42. #define BFIG_HTIC       (7*FIG_RES/80)
  43. #define BFIG_VTIC       (7*FIG_RES/80)
  44. #define BFIG_HCHAR      (9*FIG_RES/80)
  45. #define BFIG_FONT_S     (16)
  46. #define BFIG_VCHAR      ((BFIG_FONT_S)*FIG_RES/80)  /* height in pixels of font
  47.         */
  48.  
  49. #define BFIG_ARROW_WIDTH BFIG_HTIC
  50. #define BFIG_ARROW_HEIGHT BFIG_HTIC
  51.  
  52.  
  53.  
  54. /* 7 inches wide by 5 inches high */
  55. #define BFIG_XMAX (8 * FIG_RES)
  56. #define BFIG_YMAX (5 * FIG_RES)
  57.  
  58. #define BFIG_XOFF (FIG_RES/2)
  59. #define BFIG_YOFF (FIG_RES/2)
  60.  
  61.  
  62. BFIG_vector(ux,uy)
  63.      unsigned int ux,uy;
  64. {
  65.   int x=ux, y=uy;
  66.  
  67.   if (FIG_polyvec_stat != FIG_poly_part)
  68.     {
  69.       fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
  70.               O_POLYLINE, T_POLYLINE,
  71.               FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
  72.               0, 0);
  73.       fprintf(outfile, "%d %d",
  74.               BFIG_XOFF + FIG_posx, BFIG_YMAX + BFIG_YOFF - FIG_posy);
  75.       FIG_poly_vec_cnt = 1;
  76.       FIG_polyvec_stat = FIG_poly_part;
  77.     }
  78.   fprintf(outfile, " %d %d",
  79.           BFIG_XOFF +  x, BFIG_YMAX + BFIG_YOFF-y);
  80.   FIG_poly_vec_cnt++;
  81.   if (FIG_poly_vec_cnt > 50)
  82.     FIG_poly_clean(FIG_polyvec_stat);
  83.  
  84.   FIG_posx = x;
  85.   FIG_posy = y;
  86. }
  87.  
  88.  
  89.  
  90.  
  91. BFIG_arrow(sx, sy, ex, ey, head)
  92.         int sx, sy;     /* start coord */
  93.         int ex, ey;     /* end coord */
  94.     TBOOLEAN head;
  95. {
  96.     FIG_poly_clean(FIG_polyvec_stat);
  97.         fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
  98.                 O_POLYLINE, T_POLYLINE,
  99.                 FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
  100.                 head ? 1 : 0, 0);
  101.         /* arrow line */
  102.     if ( head )
  103.         fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
  104.                     0, 0, 1.0,
  105.             (double)BFIG_ARROW_WIDTH, (double)BFIG_ARROW_HEIGHT);
  106.         fprintf(outfile, "%d %d %d %d 9999 9999\n",
  107.                 BFIG_XOFF + sx, BFIG_YOFF + BFIG_YMAX - sy,
  108.         BFIG_XOFF + ex, BFIG_YOFF + BFIG_YMAX - ey);
  109.  
  110.         FIG_posx = ex;
  111.         FIG_posy = ey;
  112. }
  113.  
  114. BFIG_put_text(x, y, str)
  115.         int x, y;
  116.         char *str;
  117. {
  118.   if (strlen(str) == 0) return;
  119.   FIG_poly_clean(FIG_polyvec_stat);
  120.     y = y - BFIG_VCHAR/2;               /* assuming vertical center justified */
  121.  
  122.     fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
  123.                   O_TEXT, FIG_justify,
  124.                   FIG_ROMAN_FONT, BFIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_angle,
  125.                   1, BFIG_VCHAR, BFIG_HCHAR*strlen(str), BFIG_XOFF + x,
  126.         BFIG_YMAX + BFIG_YOFF-y, str);
  127. }
  128.  
  129.